/**
 * 
 */
package cn.ad.server.web.spring.service.bomodel;

import cn.ad.server.domain.ad.Industry;

import java.util.HashSet;
import java.util.Set;

/**
 * 平台行业类
 * @author Wu Chengjun
 */
public class PlatIndustry {
	
	/**
	 * 系统自定义行业
	 */
	private Set<Industry> industrys;
	
	/**
	 * 存储的缓存Key
	 */
	private Key key;
	
	public PlatIndustry() {
		super();
		industrys = new HashSet<Industry>();
	}

	public PlatIndustry(Set<Industry> industrys, Key key) {
		super();
		this.industrys = industrys;
		this.key = key;
	}

	/**
	 * @return the industrys
	 */
	public Set<Industry> getIndustrys() {
		return industrys;
	}

	/**
	 * @param industrys the industrys to set
	 */
	public void setIndustrys(Set<Industry> industrys) {
		this.industrys = industrys;
	}

	/**
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * @param key the key to set
	 */
	public void setKey(Key key) {
		this.key = key;
	}


	/**
	 * 用于缓存存储的Key
	 * @author Wu Chengjun
	 *
	 */
	public static class Key{
		
		public Key(long pID, long pIndustryID) {
			super();
			this.pID = pID;
			this.pIndustryID = pIndustryID;
		}

		/**
		 * 平台标识
		 */
		private long pID;
		
		/**
		 * 平台行业标识
		 */
		private long pIndustryID;

		/**
		 * @return the pID
		 */
		public long getpID() {
			return pID;
		}

		/**
		 * @param pID the pID to set
		 */
		public void setpID(long pID) {
			this.pID = pID;
		}

		/**
		 * @return the pIndustryID
		 */
		public long getpIndustryID() {
			return pIndustryID;
		}

		/**
		 * @param pIndustryID the pIndustryID to set
		 */
		public void setpIndustryID(long pIndustryID) {
			this.pIndustryID = pIndustryID;
		}

		/* (non-Javadoc)
		 * @see java.lang.Object#hashCode()
		 */
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + (int) (pID ^ (pID >>> 32));
			result = prime * result + (int) (pIndustryID ^ (pIndustryID >>> 32));
			return result;
		}

		/* (non-Javadoc)
		 * @see java.lang.Object#equals(java.lang.Object)
		 */
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Key other = (Key) obj;
			if (pID != other.pID)
				return false;
			if (pIndustryID != other.pIndustryID)
				return false;
			return true;
		}
	}
}
